home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / Libraries / UViewBehavior.cp < prev    next >
Text File  |  1991-05-01  |  4KB  |  146 lines

  1. ////////////////////////////////////////////////////////////////////////////
  2. //    UViewBehavior.cp
  3. //
  4. // Contains:        Implementation for View Behavior abstract class
  5. //
  6. // Copyright 1984-1991 Apple Computer, Inc.All rights reserved.
  7. //
  8. //    Change History:
  9. //
  10. //            3/1/91        rtm        Initial creation of file
  11. //
  12. ////////////////////////////////////////////////////////////////////////////
  13.  
  14. #ifndef __UGEOMETRY__
  15. #include <UGeometry.h>
  16. #endif
  17.  
  18. #ifndef __UMACAPPUTILITIES__
  19. #include <UMacAppUtilities.h>
  20. #endif
  21.  
  22. #ifndef __UERRORMGR__
  23. #include <UErrorMgr.h>
  24. #endif
  25.  
  26. #ifndef __UMACAPPGLOBALS__
  27. #include <UMacAppGlobals.h>
  28. #endif
  29.  
  30. #ifndef __UBEHAVIOR__
  31. #include <UBehavior.h>
  32. #endif
  33.  
  34. #ifndef __UVIEW__
  35. #include <UView.h>
  36. #endif
  37.  
  38. #ifndef __UVIEWBEHAVIOR__
  39. #include <UViewBehavior.h>
  40. #endif
  41.  
  42.  
  43. //    •••••••••••••••••••••••••••••••••••••••••••••••••
  44. //    •    TViewBehavior                                            •
  45. //    •••••••••••••••••••••••••••••••••••••••••••••••••
  46. //--------------------------------------------------------------------------------------------------
  47. #pragma    segment    MAOpen
  48.  
  49. pascal void TViewBehavior::Initialize ( void )    //    OVERRIDE
  50. {
  51.     inherited::Initialize();
  52.     
  53.     fActive = false;
  54.     
  55. }    // <- Initialize
  56.  
  57. //--------------------------------------------------------------------------------------------------
  58. #pragma    segment    MAOpen
  59.  
  60. pascal void TViewBehavior::IViewBehavior ( void )
  61. {
  62.     
  63.     this->IBehavior ();
  64.     
  65. }    // <- IViewBehavior
  66.  
  67. //--------------------------------------------------------------------------------------------------
  68. #pragma    segment    MAViewBehaviorNonRes
  69.  
  70. pascal void TViewBehavior::ActivateViewBehavior ( Boolean activate )
  71. {
  72.     
  73.     fActive = activate;
  74.     
  75.     if ( fNextBehavior )
  76.         ( ( TViewBehavior* ) fNextBehavior )->ActivateViewBehavior ( activate );
  77.     
  78. }    // <- ActivateViewBehavior
  79.  
  80. //--------------------------------------------------------------------------------------------------
  81. #pragma    segment    MAViewBehaviorNonRes
  82.  
  83. pascal TView* TViewBehavior::GetOwningView ( void )
  84. {
  85.  
  86.     if ( fOwner )
  87.         return ( TView* )fOwner;
  88.     else
  89.         return NULL;
  90.     
  91. }    // <- GetOwningView
  92.  
  93. //--------------------------------------------------------------------------------------------------
  94. #pragma    segment    MAViewBehaviorNonRes
  95.  
  96. pascal Boolean TViewBehavior::IsBehaviorActive ( void )
  97. {
  98.     if ( fNextBehavior )
  99.         return (( TViewBehavior* ) fNextBehavior)->IsBehaviorActive ();
  100.     else
  101.         return fActive;
  102.     
  103. }    // <- IsBehaviorActive
  104.  
  105. //--------------------------------------------------------------------------------------------------
  106. #pragma    segment    MASelCommand
  107.  
  108. pascal Boolean TViewBehavior::DoMouseCommand (     VPoint&                 theMouse, 
  109.                                                                 TToolboxEvent*     event, 
  110.                                                                 Point                 hysteresis )
  111. {
  112.  
  113.     if ( fNextBehavior )
  114.         return ( ( TViewBehavior* ) fNextBehavior )->DoMouseCommand ( theMouse, event, hysteresis );
  115.     else 
  116.         return false;
  117.     
  118.  
  119. }    // <- DoMouseCommand
  120.  
  121. //--------------------------------------------------------------------------------------------------
  122. #pragma    segment    MAViewBehaviorRes
  123.  
  124. pascal void TViewBehavior::Draw ( const VRect& area )
  125. {
  126.  
  127.     if ( fNextBehavior )
  128.         ( ( TViewBehavior* )fNextBehavior)->Draw ( area );
  129.         
  130. }    // <- BehaviorDraw
  131.  
  132. //--------------------------------------------------------------------------------------------------
  133. #pragma    segment    MAViewBehaviorRes
  134.  
  135. pascal Boolean TViewBehavior::DoSetCursor (     const VPoint& localPoint,
  136.                                                         RgnHandle cursorRgn )
  137. {
  138.  
  139.     if ( fNextBehavior )
  140.         return (( TViewBehavior* )fNextBehavior)->DoSetCursor ( localPoint, cursorRgn );
  141.     else
  142.         return false;
  143.     
  144. }    // <- DoSetCursor
  145.  
  146.